#@layout()

#define content()

<div class="easyui-layout" data-options="fit:true">
    <div data-options="region:'north',border:true,split:true" style="height:35px;border-top: none;overflow: hidden;"
         class="north-bg">
        <div style="margin-top: 3px;">
            <span style="font-size: 18px;">
                &nbsp; #(SystemConst.getDictSystemConst().systemName.dictText??_res.get('system.name'))
                <span style="font-size: 8px;font-style: italic;">V#(systemVersion)</span>
            </span>

            <div style="float: right;" class="navTbInfo">
                #--<a href="javascript:;" id="changeSkinMb" class="easyui-menubutton"
                      data-options="menu:'#changeSkinMm',iconCls:'icon-basket_go'">更换皮肤</a>--#

                <a href="javascript:;" id="tenantMb" class="easyui-menubutton"
                   data-options="menu:'#tenantMm',iconCls:'icon-group'">
                    #if(currTenant == null)
                    #(_res.get('system.common.select.tenant'))
                    #else
                    #(currTenant.aliasName)
                    #end
                </a>


                ### 租户
                <div id="tenantMm" style="width:200px;">

                    #for(tenant : tenants)
                    #if(currTenantId != tenant.tenantId)
                    <div data-options="iconCls:'icon-group'" onclick="changeTenant('#(tenant.tenantId)');">
                        #(tenant.aliasName)
                    </div>
                    #end
                    #end

                </div>

                <a href="javascript:;" id="userMb" class="easyui-menubutton"
                   data-options="menu:'#userMm',iconCls:'icon-user'">
                    #(sessionUser.userName)
                </a>&nbsp;&nbsp;

                #-- 更新皮肤 --#
                #--
                <div id="changeSkinMm" style="width:150px;">
                    <div data-options="iconCls:'icon-default'" onclick="changeThemeFun('default');">default</div>
                    <div data-options="iconCls:'icon-gray'" onclick="changeThemeFun('gray');">gray</div>
                    <div data-options="iconCls:'icon-bootstrap'" onclick="changeThemeFun('bootstrap');">bootstrap</div>
                    <div data-options="iconCls:'icon-black'" onclick="changeThemeFun('black');">black</div>
                    <div class="menu-sep"></div>
                    <div data-options="iconCls:'icon-metro'" onclick="changeThemeFun('metro');">metro</div>
                    <div data-options="iconCls:'icon-metro-red'" onclick="changeThemeFun('metro-red');">metro-red</div>
                    <div data-options="iconCls:'icon-metro-blue'" onclick="changeThemeFun('metro-blue');">metro-blue
                    </div>
                    <div data-options="iconCls:'icon-metro-green'" onclick="changeThemeFun('metro-green');">metro-green
                    </div>
                    <div data-options="iconCls:'icon-metro-orange'" onclick="changeThemeFun('metro-orange');">
                        metro-orange
                    </div>
                    <div data-options="iconCls:'icon-metro-gray'" onclick="changeThemeFun('metro-gray');">metro-gray
                    </div>
                    <div class="menu-sep"></div>
                    <div data-options="iconCls:'icon-ui-cupertino'" onclick="changeThemeFun('ui-cupertino');">
                        ui-cupertino
                    </div>
                    <div data-options="iconCls:'icon-ui-dark-hive'" onclick="changeThemeFun('ui-dark-hive');">
                        ui-dark-hive
                    </div>
                    <div data-options="iconCls:'icon-ui-pepper-grinder'" onclick="changeThemeFun('ui-pepper-grinder');">
                        ui-pepper-grinder
                    </div>
                    <div data-options="iconCls:'icon-ui-sunny'" onclick="changeThemeFun('ui-sunny');">ui-sunny</div>
                </div>
                --#


                #-- 用户 --#
                <div id="userMm" style="width:150px;">
                    <div data-options="iconCls:'icon-user_edit'" onclick="changePassword();">密码修改</div>
                    <div data-options="iconCls:'icon-arrow_redo'"
                         onclick="logout();">
                        #(_res.get('system.common.logout'))
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div data-options="region:'west',split:true,iconCls:'icon-application_view_columns'" id="westLayout" title="控制面板"
         style="width:200px;border-top: none;">
        <div id="controlPanel" class="easyui-accordion" data-options="fit:true,border:false">
            <div class="easyui-accordion" style="width:100%;">

                #for(resource : resourceList)
                <div title="#(_res.get(resource.resource_name))" data-options="iconCls:'icon-application_side_list'"
                     style="overflow:auto;padding:10px;">
                    #for(subResource : resource.menuList)
                    <a href="#" class="easyui-linkbutton"
                       data-options="iconCls:'icon-application_view_icons',plain:true"
                       onclick="addTab({id:11,url:'#(ctx)#(subResource.url)/#(subResource.resource_id)',title:'#(_res.get(subResource.resource_name))',iconCls:'icon-application_view_icons'})">
                        #(_res.get(subResource.resource_name))
                    </a>
                    #end
                </div>
                #end

            </div>
        </div>
    </div>

    <div data-options="region:'center'">
        <div id="index_tabs" style="overflow: hidden;">
            <div title="首页" data-options="border:false,iconCls:'icon-application_home'" style="overflow: hidden;">
                <iframe src="#(ctx)/main" id="mainPage" name="mainPage" frameborder="0"
                        scrolling="no"></iframe>
            </div>
        </div>
    </div>

    #-- 选项卡标题邮件菜单 --#
    <div id="index_tabsMenu" style="width: 120px; display: none;">
        <div title="refresh" data-options="iconCls:'icon-arrow_refresh'">刷新</div>
        <div class="menu-sep"></div>
        <div title="close" data-options="iconCls:'icon-cancel'">关闭</div>
        <div title="closeOther" data-options="iconCls:'delete'">关闭其他</div>
        <div title="closeAll" data-options="iconCls:'delete'">关闭所有</div>
    </div>
</div>

#end


#define css()
<style type="text/css">
    body {
        overflow: hidden;
    }

    .easyui-accordion a {
        width: 100%;
        text-align: left;
    }
</style>

#end


#define js()
<script type="text/javascript" src="#(ctx)/static/js/index.js"></script>
<script
        type="text/javascript">
    $(function () {
        $("#mainPage").height($(window).height() - $(".north-bg").height()/* - 50*/).width("100%");


        if ($.cookie("tenantId") === undefined) {
            $.messager.alert("提示", "渠道还没设置，请在右上角《选择渠道》进行选择！");
        }


        if (window.history && window.history.pushState) {
            $(window).on('popstate', function () {
                window.history.pushState('forward', null, '');
                window.history.forward(1);
            });
        }
        window.history.pushState('forward', null, '');
        window.history.forward(1);
    });

    function logout() {
        location.href = contextRootPath + '/user/exit';
    }


    function changePassword() {
        var params = {};
        params.title = '密码修改';
        params.width = 700;
        params.height = 250;
        params.top = '50px';
        params.modal = true;
        params.iconCls = 'icon-application_edit';
        params.url = contextRootPath + '/user/resetPwd/';
        params.buttons = [{
            text: '提交',
            iconCls: 'icon-application_go',
            handler: function () {
                updatePassword();
            }
        }, {
            text: '重置',
            iconCls: 'icon-application_side_contract',
            handler: function () {
                clearForm('formId')
            }
        }];

        crud_dlg(params);
    }

    $(window).resize(function () {
        var height = $(window).height() - 60;

        $('.easyui-layout').layout('panel', 'west').panel('resize', {height: height});
        $('.easyui-layout').layout('panel', 'center').panel('resize', {height: height});
        $('iframe').height(height - 6);

        $(".easyui-accordion").accordion("resize", {height: height});
    });
</script>

#end



